package com.greenbook.controller.user;

import com.greenbook.entity.NoteCategory;
import com.greenbook.result.Result;
import com.greenbook.service.NoteCategoryService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/noteCategory")
@Tag(name = "笔记分类相关接口")
@Slf4j
@RequiredArgsConstructor
public class NoteCategoryController {
    private final NoteCategoryService noteCategoryService;

    /**
     * 获取所有笔记分类
     * @return 笔记分类列表
     */
    @GetMapping("/list")
    @Operation(summary = "获取所有笔记分类")
    public Result<List<NoteCategory>> listAll() {
        log.info("获取所有笔记分类");
        return Result.success(noteCategoryService.listAll());
    }
}
